<?php
namespace  Home\Controller;
use Think\Controller;

class ContactController extends Controller {


    private static $adModel;
    private static $adTypeModel;
    private static $columnModel;

    private static $aboutPic;


    public function  __construct()
    {
        parent::__construct();

        if(self::$columnModel==null){
            self::$columnModel=M('column');
        }

        if(self::$adModel==null){
            self::$adModel=M('plug_ad');
        }

        if(self::$adTypeModel==null){
            self::$adTypeModel=M('plug_adtype');
        }
        if(self::$aboutPic==null){
            $adTypeModel=self::$adTypeModel;
            $type['plug_adtype_name'] = "走进七果banner图";
            $adtype = $adTypeModel->where($type)->find()['plug_adtype_id'];

            $adModel = self::$adModel;
            $condition['plug_ad_adtypeid'] = $adtype;
            $condition['plug_ad_checkid'] = 1;
            $condition['plug_ad_open'] = 1;
            $about = $adModel->field('plug_ad_pic')->order('plug_ad_order')->where($condition)->find();
            self::$aboutPic=$about;
        }
    }


    public function contact(){

        //var_dump($about);
        $this->assign('about', self::$aboutPic);
        $columnModel=self::$columnModel;
        $condition3['column_name']= '走进七果';
        $condition3['column_type']= 1;
        $condition3['column_open']= 1;
        $column_leftid=$columnModel->where($condition3)->getField('c_id');
        $condition2['column_leftid']=$column_leftid;
        $condition2['column_open']=1;
        $columns1=$columnModel->where($condition2)->order('column_order')->Field('c_id,column_name,column_content')->select();

        $this->assign('columns1', $columns1);

        $condition4['column_name']= '产品分类';
        $condition4['column_type']= 1;
        $condition4['column_open']= 1;
        $column_leftid=$columnModel->where($condition4)->getField('c_id');
        $condition5['column_open']= 1;
        $condition5['column_type']= 3;
        $condition5['column_leftid']=$column_leftid;
        $columns2=$columnModel->where($condition5)->order('column_order')->Field('c_id,column_name')->select();
        $this->assign('columns2', $columns2);

        $this->display();
    }









}